const utils = {};
var audio = uni.createInnerAudioContext()
var isPause = false   //是否在暂停状态
var previousSrc = ''   //上一个音频的地址，如果和现在的播放地址一样就进入暂停

utils.playAudios = function (src,loop=false) {
	
	if(src==previousSrc){
		audio.play()
	}else{
		audio.stop()
		audio.src = src
		previousSrc = src
		audio.onCanplay(()=> {
			audio.play()
		})	
	}

}

utils.stopAudios = function () {
	console.log('音乐停止')
	audio.pause()
}

export default utils
